//
//  UIView+Frame.m
//  StringDemo
//
//  Created by  on 16-3-23.
//  Copyright (c) 2016年 . All rights reserved.
//

#import "UIView+Frame.h"

@implementation UIView (Frame)

- (void)setS:(CGSize)size
{
    CGRect frame = self.frame;
    frame.size = size;
    self.frame = frame;
}

- (CGSize)s
{
    return self.frame.size;
}

- (CGFloat)x
{
    return self.frame.origin.x;
}

- (void)setX:(CGFloat)x
{
    CGRect frame = self.frame;
    frame.origin.x = x;
    self.frame = frame;
}

- (CGFloat)max_X
{
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setMax_X:(CGFloat)right
{
    CGRect frame = self.frame;
    frame.origin.x = right - frame.size.width;
    self.frame = frame;
}

- (CGFloat)y
{
    return self.frame.origin.y;
}

- (void)setY:(CGFloat)y
{
    CGRect frame = self.frame;
    frame.origin.y = y;
    self.frame = frame;
}

- (CGFloat)max_Y
{
    return self.frame.origin.y + self.frame.size.height;
}

- (void)setMax_Y:(CGFloat)bottom
{
    CGRect frame = self.frame;
    frame.origin.y = bottom - frame.size.height;
    self.frame = frame;
}

- (CGFloat)w
{
    return self.frame.size.width;
}

- (void)setW:(CGFloat)width
{
    CGRect frame = self.frame;
    frame.size.width = width;
    self.frame = frame;
}

- (CGFloat)h
{
    return self.frame.size.height;
}

- (void)setH:(CGFloat)height
{
    CGRect frame = self.frame;
    frame.size.height = height;
    self.frame = frame;
}

- (CGFloat)center_X
{
    return self.center.x;
}

- (void)setCenter_X:(CGFloat)center_X {
    CGPoint center = self.center;
    center.x = center_X;
    self.center = center;
}

- (CGFloat)center_Y
{
    return self.center.y;
}

- (void)setCenter_Y:(CGFloat)center_Y {
    CGPoint center = self.center;
    center.y = center_Y;
    self.center = center;
}
@end
